package com.jeeplus.modules.sys.service;

import com.jeeplus.common.json.ReturnJson;
import com.jeeplus.common.utils.DbUtils;
import com.jeeplus.common.utils.FileUtils;
import com.jeeplus.core.mapper.JsonMapper;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.BaseService;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.sys.entity.DataInterface;
import com.jeeplus.modules.sys.entity.Pagination;
import com.jeeplus.modules.sys.mapper.DataInterfaceMapper;
import com.jeeplus.modules.tools.utils.SpringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 * @title: DataInterfaceService
 * @projectName JeePlus
 * @description: TODO
 * @date 2019/11/1211:07
 */
@Service
@Transactional(readOnly = true)
public class DataInterfaceService extends BaseService {
    @Autowired
    DbUtils dbUtils;
    private String ScriptPath;
    protected JdbcTemplate db = (JdbcTemplate) SpringUtil.getApplicationContext().getBean("db");
    protected Logger logger = LoggerFactory.getLogger(getClass());

    public DataInterfaceService() {
        ScriptPath = this.getClass().getResource("/").getPath() + "/Script/DataInterface/";
    }

    public Pagination GetPageList(Pagination pagination)  {
        try {
            return findPageListLimit(pagination,db,FileUtils.getFileContent(ScriptPath+"GetPageList.sql"));
        }
        catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
